/**
 * Created by Francis.LW on 2017/10/20.
 *
 * 表单组服务接口
 */
import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const formGroupApi = urls.formGroup


function listFormGroup(param, page, pageSize, success, complete) {
  postRequest(formGroupApi.listFormGroup + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function addFormGroup(param, success, complete) {
  postRequest(formGroupApi.addFormGroup, {}, param, success, complete)
}

function updateFormGroup(id, param, success, complete) {
  postRequest(formGroupApi.updateFormGroup + id, {}, param, success, complete)
}

function getFormGroup(id, success, complete) {
  getRequest(formGroupApi.getFormGroup + id, {}, success, complete)
}

function removeFormGroup(ids, success, complete) {
  postRequest(formGroupApi.removeFormGroup, {}, ids, success, complete)
}

function deleteSingleFormGroup(id, success, complete) {
  let ids = []
  ids.push(id)
  removeFormGroup(ids, success, complete)
}

export default {
  listFormGroup,
  addFormGroup,
  updateFormGroup,
  getFormGroup,
  removeFormGroup,
  deleteSingleFormGroup
}
